package com.qiangesoft.district.gaode.constant;

/**
 * 区域等级
 *
 * @author qiangesoft
 * @date 2023-07-18
 */
public enum RegionLevelEnum {
    COUNTRY("10", "country"),
    PROVINCE("20", "province"),
    CITY("30", "city"),
    DISTRICT("40", "district"),
    STREET("50", "street"),
    ;

    private String code;
    private String des;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDes() {
        return des;
    }

    public void setDes(String des) {
        this.des = des;
    }

    RegionLevelEnum(String code, String des) {
        this.code = code;
        this.des = des;
    }

    public static String getCodeByDes(String des) {
        for (RegionLevelEnum value : values()) {
            if (value.getDes().equals(des)) {
                return value.getCode();
            }
        }
        return null;
    }
}
